<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link th:href="@{/bootstrap/bootstrap.min.css}" rel="stylesheet">
    <link rel="stylesheet" type="text/css" th:href="@{/css/jqTable.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/page/page.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/bootstrap.min.css}">
    <script th:src="@{/js/jquery-2.1.4.min.js}"></script>
    <script th:src="@{/js/laydate.js}"></script>
    <script type="text/javascript" th:src="@{/bootstrap/bootstrap-select.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/bootstrap-select.css}">
    <script type="text/javascript" th:src="@{/bootstrap/bootstrap.min.js}"></script>


    <script>
        document.addEventListener("DOMContentLoaded", function () {
            $('.selectpicker').selectpicker({
                'selectedText': 'cat'
            });
        });
    </script>
    <style type="text/css">
        .pageTest {
            width: 70%;
            height: 50px;
            margin-top: 0%;
        }

        .activP {
            background-color: #367fa9 !important;
            color: #fff !important;
        }
    </style>
    <style>
        .p20 {
            padding: 20px;
        }

        .mt20 {
            margin-top: 20px;
        }

        .mr10 {
            margin-right: 10px;
        }

        .hide {
            display: none;
        }

    </style>
</head>
<h2 style="text-align: center">日志配置</h2>
<body style="background-color: #f9f9f9;opacity: 0.85;padding-left:5%;padding-right: 5%;-webkit-background-size: 100%;background-repeat: no-repeat;background-size: cover;background-attachment: fixed">
<div class="g-selectAll--main">
    <div class="c-table c-table--border">
        <table id="tab02" cellspacing="0" cellpadding="0" border="1" role="c-table">
            <span>
                <thead>
            <tr>
                <th>
                    <b>
                        日志名称
                    </b>
                </th>
                <th>
                    <b>
                        日志说明
                    </b>
                </th>
                <th>
                    <b>
                        记录日志
                    </b>
                </th>
                <th>
                    <b>
                        自动清理
                    </b>
                </th>
                <th>
                    <b>
                        清空周期
                    </b>
                </th>
                <th>
                    <b>
                        操作
                    </b>
                </th>
            </tr>
            </thead>
            <tbody th:if="${actiondefs}">
            <tr th:each="actiondef:${actiondefs}">
                <td hidden="hidden" th:id="${actiondef.actionid}+'0'" th:text="${actiondef.actionid}"></td>
                <td th:id="${actiondef.actionid}+'1'" th:text="${actiondef.actionname}"></td>
                <td th:id="${actiondef.actionid}+'2'" th:text="${actiondef.actiondesc}"></td>
                <td >
                     <select th:id="${actiondef.actionid}+'3'" style="width: 100%;height: 100%;border: 0px" data-live-search="true" class="form-control">
                        <option th:selected="${actiondef.isrecord} eq '1'" value="1">是</option>
                        <option th:selected="${actiondef.isrecord} eq '0'" value="0">否</option>
                    </select>
                </td>
                <td>
                    <input th:id="${actiondef.actionid}+'4'" type="checkbox" th:checked="${actiondef.selfdelete} eq '1'">
                </td>
                <td>
                    <select th:id="${actiondef.actionid}+'5'" style="width: 100%;height: 100%;border: 0px" data-live-search="true" class="form-control">
                        <option th:selected="${actiondef.roundday} eq '7'" value="7">一个周</option>
                        <option th:selected="${actiondef.roundday} eq '30'" value="30">一个月</option>
                        <option th:selected="${actiondef.roundday} eq '90'" value="90">三个月</option>
                    </select>
                </td>
                <td>
                    <button style="width: 100%;height: 100%" class="btn-default"
                            th:onclick="|javascript:change('${actiondef.actionid}')|"
                    >提交</button>
                </td>
            </tr>
            </tbody>
            </span>

        </table>
    </div>
</div>


<!--<script th:src="@{/pdfjs/jquery-1.11.3.min.pdfjs}"></script>-->
<script type="text/javascript" th:src="@{/page/page.js}"></script>

<!--开源模版引擎： art-template@4.12.2 for browser | https://github.com/aui/art-template  -->
<script th:src="@{/js/plugins/artTemplate.js}"></script>
<!--另一个插件，消息提示插件  -->
<script th:src="@{/js/plugins/message.js}"></script>
<!-- 必要插件：固定列滚动需要用到，鼠标滚动兼容多浏览器 -->
<script th:src="@{/js/jquery.mousewheel.min.js}"></script>
<!-- 总引入  -->
<script th:src="@{/js/zipJs/jqTable.all.min.js}"></script>
<!-- 临时用的json -->
<script th:src="@{/js/json.js}"></script>

<script>
    function change(id) {
        var i0 = id+'0';
        var i1 = id+'1';
        var i2 = id+'2';
        var i3 = id+'3';
        var i4 = id+'4';
        var i5 = id+'5';
        var v0 = document.getElementById(i0).innerHTML.trim()
        var v1 = document.getElementById(i1).innerHTML.trim()
        var v2=document.getElementById(i2).innerHTML.trim()
        var v401 = document.getElementById(i4).checked
        var v4=(v401==true?1:0)
        var v301=document.getElementById(i3);
        var v3=v301.options[v301.selectedIndex].value;
        var v501 = document.getElementById(i5);
        var v5=v501.options[v501.selectedIndex].value;
        $.post("/admin/admin/actiondefPost",{
                actionid: v0,
                isrecord: v3,
                actionname: v1,
                actiondesc: v2,
                selfdelete: v4,
                roundday: v5
        },function () {
            alert("修改成功"),
                window.location.reload()
            }
        )
    }
</script>

</body>
</html>
